<!--
 * @Author: zhangxiangsheng 1026583651@qq.com
 * @Date: 2024-06-24 09:53:40
 * @LastEditors: zhangxiangsheng 1026583651@qq.com
 * @LastEditTime: 2024-06-24 10:08:26
 * @FilePath: \appGly\uni_modules\uview-ui\components\u-select\u-select.vue
 * @Description: 
 * 
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. 
-->
<template>
  <view>
    <!-- {{ list }} -->
    <u-picker
      :show="value"
      :columns="columns"
      @confirm="confirm"
      @cancel="cancel"
    ></u-picker>
  </view>
</template>
<script>
  export default {
    name: "u-select",
    props: {
      value: {
        type: Boolean,
        default: false,
      },
      list: {
        type: Array,
        default: () => {
          return [];
        },
      },
    },
    data() {
      return {};
    },
    computed: {
      columns() {
        let r = this.list.map((e) => {
          return e.label;
        });
        return [r];
      },
    },
    methods: {
      confirm(e) {
        let r = this.list[e.indexs[0]];
        console.log(r);
        this.$emit("confirm", [r]);
        this.$emit("input", false);
      },
      cancel() {
        this.$emit("input", false);
      },
    },
  };
</script>
